package com.example.service;


import com.example.common.Spart;
import com.example.common.StorePart;
import com.example.dao.PartsRepository;
import com.example.entity.Part;
import com.example.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class PartsService {

    @Autowired
    PartsRepository partsRepository;

    public void save(Part part) {

        partsRepository.add(part);
    }

    public List<StorePart> findStoreByPidCid(Long store_pid, Long store_container_pid) {
        return partsRepository.findStoreByPidCid(store_pid, store_container_pid);
    }

    public List<StorePart> findStoreByPid(Long store_pid) {
        return partsRepository.findStoreByPid(store_pid);
    }

    public List<StorePart> findStoreByCid(Long store_container_pid) {
        return partsRepository.findStoreByCid(store_container_pid);
    }

    public List<StorePart> findAllStore() {
        return partsRepository.findAllStore();
    }

    public List<StorePart> findStoreFuzzy(String part_name_f) {
        return partsRepository.findStoreFuzzy(part_name_f);
    }

    public List<StorePart> findStoreByRid(long store_rid) {
        return partsRepository.findStoreByRid(store_rid);
    }

    public List<Spart> findPartsByPid(Long pid) {
        return partsRepository.findPartsByPid(pid);
    }
    public List<Spart> findPartsByName(String name) {
        return partsRepository.findPartsByName(name);
    }
    public List<Spart> findAllParts() {
        return partsRepository.findAllParts();
    }

    public List<Spart> findContainersByPid(Long pid) {
        return partsRepository.findContainersByPid(pid);
    }
    public List<Spart> findContainersByName(String name) {
        return partsRepository.findContainersByName(name);
    }
    public List<Spart> findAllContainers() {
        return partsRepository.findAllContainers();
    }
    public void storeParts(StorePart storePart) {partsRepository.storeParts(storePart);}
    public void adjStore(long rid, int quantity) {partsRepository.adjStore(rid, quantity);}



}
